﻿using M_Quality.API.Application.Command.QualitygroupCommand;
using M_Quality.Domain;
using M_Quality.Repository.Interface;
using MediatR;

namespace M_Quality.API.Application.CommandHandler.QualitygroupHandler
{
    public class QualitygroupCreateCommandHandler : IRequestHandler<QualitygroupCreactCommand, int>
    {
        protected readonly IQualitygroupRepository qualitygroupRepository;

        public QualitygroupCreateCommandHandler(IQualitygroupRepository qualitygroupRepository)
        {
            this.qualitygroupRepository = qualitygroupRepository;
        }

        public Task<int> Handle(QualitygroupCreactCommand request, CancellationToken cancellationToken)
        {
            return qualitygroupRepository.AddAsync(request);
        }
    }
}
